library(Seurat)
library(SeuratDisk)
library(reticulate)
library(scrubletR)
library(ggplot2)
library(patchwork)
library(dplyr)
library(data.table)
library(clustree)
library(reshape2)
library(tidyr)
library(gridExtra)
Warning: package ‘gridExtra’ was built under R version 4.3.3
Attaching package: ‘gridExtra’

The following object is masked from ‘package:dplyr’:

    combine
library(stringr)
library(plyr)
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
You have loaded plyr after dplyr - this is likely to cause problems.
If you need functions from both plyr and dplyr, please load plyr first, then dplyr:
library(plyr); library(dplyr)
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Attaching package: ‘plyr’

The following object is masked from ‘package:purrr’:

    compact

The following objects are masked from ‘package:dplyr’:

    arrange, count, desc, failwith, id, mutate, rename, summarise, summarize
source("C:/Ryan/GitHub/trachtenberg-lab/transcriptomics/tools/seurat_functions.R")
source("C:/Ryan/GitHub/trachtenberg-lab/transcriptomics/tools/seurat_integration_functions.R")
source("C:/Ryan/GitHub/trachtenberg-lab/transcriptomics/xgboost/xgboost_train.R")
source("C:/Ryan/GitHub/trachtenberg-lab/transcriptomics/xgboost/plottingFxns.R")

obj.integrated <- IntegrateObjects(objs[[1]], objs[[2]], resolutions = c(1), nfeatures = 6000, subsample = TRUE)

  |                                                  | 0 % ~calculating  
  |+++++++++++++++++++++++++                         | 50% ~09s          
  |++++++++++++++++++++++++++++++++++++++++++++++++++| 100% elapsed=24s  
Finding all pairwise anchors

  |                                                  | 0 % ~calculating  
Running CCA
Merging objects
Finding neighborhoods
Finding anchors
    Found 21341 anchors
Filtering anchors
    Retained 11098 anchors

  |++++++++++++++++++++++++++++++++++++++++++++++++++| 100% elapsed=12m 38s
sct.model: model1
Setting min_variance based on median UMI:  0.04
Calculating residuals of type pearson for 6805 genes

  |                                                                                                                                                                                                 
  |                                                                                                                                                                                           |   0%
  |                                                                                                                                                                                                 
  |=======                                                                                                                                                                                    |   4%
  |                                                                                                                                                                                                 
  |==============                                                                                                                                                                             |   7%
  |                                                                                                                                                                                                 
  |=====================                                                                                                                                                                      |  11%
  |                                                                                                                                                                                                 
  |============================                                                                                                                                                               |  15%
  |                                                                                                                                                                                                 
  |===================================                                                                                                                                                        |  19%
  |                                                                                                                                                                                                 
  |==========================================                                                                                                                                                 |  22%
  |                                                                                                                                                                                                 
  |================================================                                                                                                                                           |  26%
  |                                                                                                                                                                                                 
  |=======================================================                                                                                                                                    |  30%
  |                                                                                                                                                                                                 
  |==============================================================                                                                                                                             |  33%
  |                                                                                                                                                                                                 
  |=====================================================================                                                                                                                      |  37%
  |                                                                                                                                                                                                 
  |============================================================================                                                                                                               |  41%
  |                                                                                                                                                                                                 
  |===================================================================================                                                                                                        |  44%
  |                                                                                                                                                                                                 
  |==========================================================================================                                                                                                 |  48%
  |                                                                                                                                                                                                 
  |=================================================================================================                                                                                          |  52%
  |                                                                                                                                                                                                 
  |========================================================================================================                                                                                   |  56%
  |                                                                                                                                                                                                 
  |===============================================================================================================                                                                            |  59%
  |                                                                                                                                                                                                 
  |======================================================================================================================                                                                     |  63%
  |                                                                                                                                                                                                 
  |=============================================================================================================================                                                              |  67%
  |                                                                                                                                                                                                 
  |====================================================================================================================================                                                       |  70%
  |                                                                                                                                                                                                 
  |===========================================================================================================================================                                                |  74%
  |                                                                                                                                                                                                 
  |=================================================================================================================================================                                          |  78%
  |                                                                                                                                                                                                 
  |========================================================================================================================================================                                   |  81%
  |                                                                                                                                                                                                 
  |===============================================================================================================================================================                            |  85%
  |                                                                                                                                                                                                 
  |======================================================================================================================================================================                     |  89%
  |                                                                                                                                                                                                 
  |=============================================================================================================================================================================              |  93%
  |                                                                                                                                                                                                 
  |====================================================================================================================================================================================       |  96%
  |                                                                                                                                                                                                 
  |===========================================================================================================================================================================================| 100%
sct.model: model1
Setting min_variance based on median UMI:  0.04
Calculating residuals of type pearson for 6805 genes

  |                                                                                                                                                                                                 
  |                                                                                                                                                                                           |   0%
  |                                                                                                                                                                                                 
  |=======                                                                                                                                                                                    |   4%
  |                                                                                                                                                                                                 
  |==============                                                                                                                                                                             |   7%
  |                                                                                                                                                                                                 
  |=====================                                                                                                                                                                      |  11%
  |                                                                                                                                                                                                 
  |============================                                                                                                                                                               |  15%
  |                                                                                                                                                                                                 
  |===================================                                                                                                                                                        |  19%
  |                                                                                                                                                                                                 
  |==========================================                                                                                                                                                 |  22%
  |                                                                                                                                                                                                 
  |================================================                                                                                                                                           |  26%
  |                                                                                                                                                                                                 
  |=======================================================                                                                                                                                    |  30%
  |                                                                                                                                                                                                 
  |==============================================================                                                                                                                             |  33%
  |                                                                                                                                                                                                 
  |=====================================================================                                                                                                                      |  37%
  |                                                                                                                                                                                                 
  |============================================================================                                                                                                               |  41%
  |                                                                                                                                                                                                 
  |===================================================================================                                                                                                        |  44%
  |                                                                                                                                                                                                 
  |==========================================================================================                                                                                                 |  48%
  |                                                                                                                                                                                                 
  |=================================================================================================                                                                                          |  52%
  |                                                                                                                                                                                                 
  |========================================================================================================                                                                                   |  56%
  |                                                                                                                                                                                                 
  |===============================================================================================================                                                                            |  59%
  |                                                                                                                                                                                                 
  |======================================================================================================================                                                                     |  63%
  |                                                                                                                                                                                                 
  |=============================================================================================================================                                                              |  67%
  |                                                                                                                                                                                                 
  |====================================================================================================================================                                                       |  70%
  |                                                                                                                                                                                                 
  |===========================================================================================================================================                                                |  74%
  |                                                                                                                                                                                                 
  |=================================================================================================================================================                                          |  78%
  |                                                                                                                                                                                                 
  |========================================================================================================================================================                                   |  81%
  |                                                                                                                                                                                                 
  |===============================================================================================================================================================                            |  85%
  |                                                                                                                                                                                                 
  |======================================================================================================================================================================                     |  89%
  |                                                                                                                                                                                                 
  |=============================================================================================================================================================================              |  93%
  |                                                                                                                                                                                                 
  |====================================================================================================================================================================================       |  96%
  |                                                                                                                                                                                                 
  |===========================================================================================================================================================================================| 100%
Merging dataset 2 into 1
Extracting anchors for merged samples
Finding integration vectors
Finding integration vector weights
0%   10   20   30   40   50   60   70   80   90   100%
[----|----|----|----|----|----|----|----|----|----|
**************************************************|
Integrating data
Warning: sparse->dense coercion: allocating vector of size 1.7 GiBWarning in paste(condition$message, collapse = "\n") :
  NAs introduced by coercion to integer range
Warning in paste(prefix, message) :
  NAs introduced by coercion to integer range
Warning: NAs introduced by coercion to integer rangeWarning in paste(condition$message, collapse = "\n") :
  NAs introduced by coercion to integer range
Warning in paste(prefix, message) :
  NAs introduced by coercion to integer range
Warning: NAs introduced by coercion to integer rangeWarning in paste(condition$message, collapse = "\n") :
  NAs introduced by coercion to integer range
Warning in paste(prefix, message) :
  NAs introduced by coercion to integer range
Warning: NAs introduced by coercion to integer rangeWarning in paste(condition$message, collapse = "\n") :
  NAs introduced by coercion to integer range
Warning in paste(prefix, message) :
  NAs introduced by coercion to integer range
Warning: NAs introduced by coercion to integer rangeWarning in paste(condition$message, collapse = "\n") :
  NAs introduced by coercion to integer range
Warning in paste(prefix, message) :
  NAs introduced by coercion to integer range
Warning: NAs introduced by coercion to integer rangeWarning in paste(condition$message, collapse = "\n") :
  NAs introduced by coercion to integer range
Warning in paste(prefix, message) :
  NAs introduced by coercion to integer range
Warning: NAs introduced by coercion to integer rangeWarning in paste(condition$message, collapse = "\n") :
  NAs introduced by coercion to integer range
Warning in paste(prefix, message) :
  NAs introduced by coercion to integer range
Warning: NAs introduced by coercion to integer rangeWarning in paste(condition$message, collapse = "\n") :
  NAs introduced by coercion to integer range
Warning in paste(prefix, message) :
  NAs introduced by coercion to integer range
Warning: NAs introduced by coercion to integer rangeWarning in paste(condition$message, collapse = "\n") :
  NAs introduced by coercion to integer range
Warning in paste(prefix, message) :
  NAs introduced by coercion to integer range
Warning: NAs introduced by coercion to integer rangeWarning in paste(condition$message, collapse = "\n") :
  NAs introduced by coercion to integer range
Warning in paste(prefix, message) :
  NAs introduced by coercion to integer range
Warning: NAs introduced by coercion to integer rangeWarning in paste(condition$message, collapse = "\n") :
  NAs introduced by coercion to integer range
Warning in paste(prefix, message) :
  NAs introduced by coercion to integer range
Warning: NAs introduced by coercion to integer rangeWarning in paste(condition$message, collapse = "\n") :
  NAs introduced by coercion to integer range
Warning in paste(prefix, message) :
  NAs introduced by coercion to integer range
Warning: NAs introduced by coercion to integer rangeWarning in paste(condition$message, collapse = "\n") :
  NAs introduced by coercion to integer range
Warning in paste(prefix, message) :
  NAs introduced by coercion to integer range
Warning: NAs introduced by coercion to integer rangeWarning in paste(condition$message, collapse = "\n") :
  NAs introduced by coercion to integer range
Warning in paste(prefix, message) :
  NAs introduced by coercion to integer range
Warning: NAs introduced by coercion to integer rangeWarning in paste(condition$message, collapse = "\n") :
  NAs introduced by coercion to integer range
Warning in paste(prefix, message) :
  NAs introduced by coercion to integer range
Warning: NAs introduced by coercion to integer rangeWarning in paste(condition$message, collapse = "\n") :
  NAs introduced by coercion to integer range
Warning in paste(prefix, message) :
  NAs introduced by coercion to integer range
Warning: NAs introduced by coercion to integer rangeWarning in paste(condition$message, collapse = "\n") :
  NAs introduced by coercion to integer range
Warning in paste(prefix, message) :
  NAs introduced by coercion to integer range
Warning: NAs introduced by coercion to integer rangeWarning in paste(condition$message, collapse = "\n") :
  NAs introduced by coercion to integer range
Warning in paste(prefix, message) :
  NAs introduced by coercion to integer range
Warning: NAs introduced by coercion to integer rangeWarning in paste(condition$message, collapse = "\n") :
  NAs introduced by coercion to integer range
Warning in paste(prefix, message) :
  NAs introduced by coercion to integer range
Warning: NAs introduced by coercion to integer rangeWarning in paste(condition$message, collapse = "\n") :
  NAs introduced by coercion to integer range
Warning in paste(prefix, message) :
  NAs introduced by coercion to integer range
Warning: NAs introduced by coercion to integer rangeWarning in paste(condition$message, collapse = "\n") :
  NAs introduced by coercion to integer range
Warning in paste(prefix, message) :
  NAs introduced by coercion to integer range
Warning: NAs introduced by coercion to integer rangeWarning in paste(condition$message, collapse = "\n") :
  NAs introduced by coercion to integer range
Warning in paste(prefix, message) :
  NAs introduced by coercion to integer range
Warning: NAs introduced by coercion to integer range

subclasses <- c(c("L2/3", "L4", "L5IT", "L5NP", "L5PT", "L6CT", "L6IT", "L6b"), as.character(1:11))
PlotIntegration(obj.integrated, "species", c("integrated_snn_res.1"), subclasses)


objs.i <- SplitObject(obj.integrated, split.by = "species")

objs.m <- MapObjects(objs.i[[1]], objs.i[[2]], c("subclass", "type"), assay = "integrated")
Warning: Both reference and query assays have been processed with SCTransform.Setting normalization.method = 'SCT' and continuing.Normalizing query using reference SCT model
Projecting cell embeddings
Finding neighborhoods
Finding anchors
    Found 2643 anchors
Filtering anchors
    Retained 528 anchors
Warning: `invoke()` is deprecated as of rlang 0.4.0.Finding integration vectors
Finding integration vector weights
0%   10   20   30   40   50   60   70   80   90   100%
[----|----|----|----|----|----|----|----|----|----|
**************************************************|
Predicting cell labels
Predicting cell labels

  |                                                  | 0 % ~calculating  

Integrating dataset 2 with reference dataset
Finding integration vectors
Integrating data

  |++++++++++++++++++++++++++++++++++++++++++++++++++| 100% elapsed=00s  
Computing nearest neighbors
Running UMAP projection
16:07:05 Read 10485 rows
16:07:05 Processing block 1 of 1
16:07:05 Commencing smooth kNN distance calibration using 1 thread with target n_neighbors = 30
16:07:05 Initializing by weighted average of neighbor coordinates using 1 thread
16:07:05 Commencing optimization for 67 epochs, with 314550 positive edges
Using method 'umap'
0%   10   20   30   40   50   60   70   80   90   100%
[----|----|----|----|----|----|----|----|----|----|
**************************************************|
16:07:08 Finished
Warning: Both reference and query assays have been processed with SCTransform.Setting normalization.method = 'SCT' and continuing.Normalizing query using reference SCT model
Projecting cell embeddings
Finding neighborhoods
Finding anchors
    Found 1163 anchors
Filtering anchors
    Retained 308 anchors
Finding integration vectors
Finding integration vector weights
0%   10   20   30   40   50   60   70   80   90   100%
[----|----|----|----|----|----|----|----|----|----|
**************************************************|
Predicting cell labels
Predicting cell labels
Warning: Feature names cannot have underscores ('_'), replacing with dashes ('-')

  |                                                  | 0 % ~calculating  

Integrating dataset 2 with reference dataset
Finding integration vectors
Integrating data

  |++++++++++++++++++++++++++++++++++++++++++++++++++| 100% elapsed=00s  
Computing nearest neighbors
Running UMAP projection
16:08:12 Read 10485 rows
16:08:12 Processing block 1 of 1
16:08:12 Commencing smooth kNN distance calibration using 1 thread with target n_neighbors = 30
16:08:12 Initializing by weighted average of neighbor coordinates using 1 thread
16:08:12 Commencing optimization for 67 epochs, with 314550 positive edges
Using method 'umap'
0%   10   20   30   40   50   60   70   80   90   100%
[----|----|----|----|----|----|----|----|----|----|
**************************************************|
16:08:17 Finished

PlotMapping(objs.m, ident.order = subclasses)


DimPlot(obj.mouse.glutamatergic.P38, group.by = "subclass", label = TRUE, raster = FALSE) + NoLegend() + xlim(-18, 18) + ylim(-18, 18) + coord_equal()

vfs <- VariableFeatures(obj.mouse.glutamatergic.P38[["SCT"]])
for (vf in 1:20) {
  p <- FeaturePlot(obj.mouse.glutamatergic.P38, features = vfs[vf], max.cutoff = 10, raster = FALSE) + xlim(-18, 18) + ylim(-18, 18) + coord_equal()
  print(p)
}
Scale for x is already present.
Adding another scale for x, which will replace the existing scale.Scale for y is already present.
Adding another scale for y, which will replace the existing scale.


DimPlot(obj.opossum.glutamatergic, group.by = "SCT_snn_res.1", label = TRUE, raster = FALSE) + NoLegend() + xlim(-18, 18) + ylim(-18, 18) + coord_equal()

vfs <- VariableFeatures(obj.opossum.glutamatergic[["SCT"]])
for (vf in 21:40) {
  p <- FeaturePlot(obj.opossum.glutamatergic, features = vfs[vf], max.cutoff = 10, raster = FALSE) + xlim(-18, 18) + ylim(-18, 18) + coord_equal()
  print(p)
}
Scale for x is already present.
Adding another scale for x, which will replace the existing scale.Scale for y is already present.
Adding another scale for y, which will replace the existing scale.


Idents(obj.opossum.glutamatergic) <- "SCT_snn_res.1"
obj.opossum.glutamatergic.IT <- subset(obj.opossum.glutamatergic, idents = c(2, 3, 4, 5, 7, 8, 9, 10, 11, 13, 14, 15, 17, 19))
obj.opossum.glutamatergic.IT <- ClusterSCT(obj.opossum.glutamatergic.IT, resolutions = c(1))

PlotClusters(obj.opossum.glutamatergic.IT, group.id = "SCT_snn_res.1")
Scale for x is already present.
Adding another scale for x, which will replace the existing scale.Scale for y is already present.
Adding another scale for y, which will replace the existing scale.Scale for x is already present.
Adding another scale for x, which will replace the existing scale.Scale for y is already present.
Adding another scale for y, which will replace the existing scale.

LS0tDQp0aXRsZTogIlIgTm90ZWJvb2siDQpvdXRwdXQ6IGh0bWxfbm90ZWJvb2sNCi0tLQ0KDQoNCmBgYHtyfQ0KDQpsaWJyYXJ5KFNldXJhdCkNCmxpYnJhcnkoU2V1cmF0RGlzaykNCmxpYnJhcnkocmV0aWN1bGF0ZSkNCmxpYnJhcnkoc2NydWJsZXRSKQ0KbGlicmFyeShnZ3Bsb3QyKQ0KbGlicmFyeShwYXRjaHdvcmspDQpsaWJyYXJ5KGRwbHlyKQ0KbGlicmFyeShkYXRhLnRhYmxlKQ0KbGlicmFyeShjbHVzdHJlZSkNCmxpYnJhcnkocmVzaGFwZTIpDQpsaWJyYXJ5KHRpZHlyKQ0KbGlicmFyeShncmlkRXh0cmEpDQpsaWJyYXJ5KHN0cmluZ3IpDQpsaWJyYXJ5KHBseXIpDQpzb3VyY2UoIkM6L1J5YW4vR2l0SHViL3RyYWNodGVuYmVyZy1sYWIvdHJhbnNjcmlwdG9taWNzL3Rvb2xzL3NldXJhdF9mdW5jdGlvbnMuUiIpDQpzb3VyY2UoIkM6L1J5YW4vR2l0SHViL3RyYWNodGVuYmVyZy1sYWIvdHJhbnNjcmlwdG9taWNzL3Rvb2xzL3NldXJhdF9pbnRlZ3JhdGlvbl9mdW5jdGlvbnMuUiIpDQpzb3VyY2UoIkM6L1J5YW4vR2l0SHViL3RyYWNodGVuYmVyZy1sYWIvdHJhbnNjcmlwdG9taWNzL3hnYm9vc3QveGdib29zdF90cmFpbi5SIikNCnNvdXJjZSgiQzovUnlhbi9HaXRIdWIvdHJhY2h0ZW5iZXJnLWxhYi90cmFuc2NyaXB0b21pY3MveGdib29zdC9wbG90dGluZ0Z4bnMuUiIpDQoNCiMgb2JqLm9wb3NzdW0uZ2x1dGFtYXRlcmdpYyA8LSBy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